import uvicorn
from fastapi import FastAPI, APIRouter
from fastapi.middleware.cors import CORSMiddleware
from api.user import router as user_router
from api.post import router as post_router

app = FastAPI()
api_router = APIRouter(prefix="/api")

api_router.include_router(user_router)
api_router.include_router(post_router)
app.include_router(api_router)
app.add_middleware(
    CORSMiddleware,
    allow_origins=['*'],
    allow_credentials=False,
    allow_methods=['*'],
    allow_headers=['*'],
)


@app.get("/")
def hello_world():
    return {"hello": "world"}


if __name__ == "__main__":
    uvicorn.run(app="main:app", host="10.96.181.5", port=8000, reload=True)
